package com.test.jbpm.service.impl;


import java.io.File;
import java.io.InputStream;

import org.jbpm.api.ProcessDefinition;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.test.jbpm.Pager;
import com.test.jbpm.dao.ProcessDefinitionDao;
import com.test.jbpm.service.ProcessDefinitionService;


@Service
public class ProcessDefinitionServiceImpl implements ProcessDefinitionService {

	private ProcessDefinitionDao processDefinitionDao;
	
	@Autowired
	public void setProcessDefinitionDao(ProcessDefinitionDao processDefinitionDao) {
		this.processDefinitionDao = processDefinitionDao;
	}

	public Pager<ProcessDefinition> findProcessDefinitionList() {
		return processDefinitionDao.findProcessDefinitionList();
	}

	public void add(File processDefinitionFile) {
		processDefinitionDao.add(processDefinitionFile);
	}

	public void del(String[] deploymentIds) {
		for (String deploymentId : deploymentIds) {
			processDefinitionDao.del(deploymentId);
		}
	}

	public InputStream viewImage(String deploymentId, String imageResourceName) {
		return processDefinitionDao.viewImage(deploymentId, imageResourceName);
	}

	public InputStream viewConent(String deploymentId) {
		return processDefinitionDao.viewConent(deploymentId);
	}
}
